1. Field of the Invention
The invention relates generally to the field of digital data processing systems, and more specifically to systems having memory management arrangements incorporating demand-paged virtual addressing in a protection ring environment for regulating access to data as between applications and operating system programs. When a program requires data from two separate pages in memory in a single transfer, the invention enables the processor to determine the right of the program to access the data in both pages before any transfer occurs. If an access does not require data from two pages in the memory, the invention only performs the access check procedure once since all of the data in a page is available to programs having the same access rights.
2. Description of the Prior Art
A digital data processing system generally includes three basic elements; namely, a memory element, one or more input/output elements, and a processor element, all of which are interconnected by one or more buses. The memory element stores data in addressable storage locations. This data includes both operands and instructions for processing the operands. The processor element causes data to be transferred to it, or fetched, from the memory element, interprets the incoming data as either instructions or operands, and processes the operands in accordance with the instructions. The results are then stored in the memory element. Input/output elements also communicate with the memory element in order to transfer data into the system and to obtain the processed data from it. The input/output elements normally operate in accordance with control information supplied by the processor element. The input/output elements may include, for example, printers, teletypewriters, or keyboards and video display terminals, and may also include secondary data storage devices such as disk drives or tape drives.
In most modern data processing systems, the number of addressable storage locations, that is, the address space, that are physically present in the memory element is generally substantially less than the total number of locations which can be addressed. The potential address space in modern computer systems may be anywhere from 64 kilobytes in a system which has address words of 16 address bits, to more than four gigabytes in a system having address words of 32 bits. While modern systems currently can easily include 64 kilobytes of memory, because of space and cost limitations, a four gigabyte memory is impractical. Indeed, in many computer systems, the maximum number of storage locations that are physically present in a memory element is on the order of 10 megabytes.
To allow a programmer to use an address space which may be larger than is physically present in a computer system, virtual address techniques are used. In virtual addressing, both the virtual and the physical address spaces are divided into blocks of contiguous storage locations called "pages", with the pages in virtual address space being the same size, that is, having the same number of locations, as the pages in physical address space. In virtual address systems used by the assignee of the present invention, a page generally represents five hundred and twelve byte storage locations in both virtual and physical memory. The pages which are not being used are stored in the disk or tape drives rather than in the physical memory. Thus, the memory element contains only the pages which are currently being used, and those pages which were most recently used, by the applications program.
When a program requires data in pages which may not be physically present in the memory, the operating system transfers the entire page from the disk containing the page of data into a page in the memory. Since this operation may cause data present in the memory to be overwritten, the operating system may have to transfer the data in the page being overwritten onto the disk. This process, known as "swapping", is essentially transparent to the applications program; that is, since the operation is performed by the operating system rather than the applications program, the applications program need not be aware of either size or configuration of the memory, or the location of the page containing the required data in the disk drive.
After the required page is loaded into memory, the processor must be able to locate the data in the memory for the applications program. The processor performs an address translation from the page containing the virtual address to identify the page in the physical memory. In the virtual address systems used by the assignee, this translation includes the use of a page table entry, which contains the page frame number, that is the identification of the physical page in memory. To shorten the time required for the translation, which can normally take several memory accesses for each translation, processors use translation buffers located in the processor modules themselves which contain a small number of recently used page table entries.
As has been noted, programs processed by a data processing system can be classified as applications programs or operating system programs, which have distinct protection rings to prevent an applications program from modifying instruction code or data for an operating system program, and vice versa. In some systems, the operating system programs may be further divided into several types of programs. For example, in VAX-11 processors using VMS operating systems sold by the assignee of this invention, the operating system programs are divided into kernel, supervisor, and executive programs, each having a separate protection ring. In other operating systems, such as Unix, the various programs forming the operating system are divided similarly.
When a processor attempts to access the contents of a location in memory for a program, whether it be an operating system or an applications program, it first must determine whether the program it is running has the right to access the data. For example, if a processor is running a user program, it normally cannot retrieve data from, or write data to, pages containing data for any of the operating system programs. Typically, all of the data in a page in memory is available to programs having the same access rights. That is, all of the data in each page is available to a user program, or to a program in the kernel, executive, or supervisor, and so data that is accessible by programs in the different protection rings is not loaded into the same page. However, data in different pages is accessible by programs in the different protection rings.
In many modern data processing systems, the smallest addressable unit of data is a byte of eight bits. In systems including the aforementioned VAX-11 processors, up to four bytes of data, that is, one longword, can be requested and retrieved at one time. However, unless the requested longword is such that the address of the least significant byte is longword-aligned, that is, the two least significant bits of the byte's address are zero, two retrievals may have to be performed from contiguous locations in memory to obtain the requested data.
When a processor accesses memory, it thus has to check several things, including whether the page containing the requested data is in memory and whether the requesting program has the right to access the data. In prior processors, if a program requested a memory access which required multiple memory accesses, the processor performed the access check on all of the locations before it made any transfer, since it was desirable to ensure that the request could be completed before any transfers were performed whether or not the accesses were to locations in the same page. However, if the access was to locations in the same page, only one access check would be sufficient to verify that all transfers could take place, since, if the program has access to the first location and the page is in memory, it would be able to perform the other transfers. Thus, it is wasteful to delay the first transfer of a multiple-transfer memory access when all accesses are to the same page and the first access check indicates that the transfer can take place.